<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Partner_Model extends CI_Model {

    protected $_lang = '';
    protected $_table = 'partners' ;
    
    function __construct() {
        parent::__construct();
    }

    public function initialise($lang) {
        if ($lang != '' && $lang != 'vn')
            $this->_lang = '_' . $lang;
        else
            $this->_lang = '';
    }

    function getPartners($conditions,  $start = 0, $num = 20) {
        $this->db->where('bl_active', 1);
        if(!empty($conditions)) {
            foreach($conditions as $key => $value) {
                $this->db->where($key, $value);
            }
        }
        return $this->db->get($this->_table)->result();
    }

    function getPartnersFromId($alias) {
        $this->db->where('bl_active', 1);
        $this->db->where('name_alias',$alias);
        return $this->db->get($this->_table)->row();
    }

}